﻿Imports DTO
Imports System.Data.OleDb


Public Class KhoiDAO

    Public Function LayDanhSach() As List(Of KhoiDTO)
        Dim ds As New List(Of KhoiDTO)
        Dim conn As OleDbConnection = DataProvider.ConnectDB()
        Dim strSQL As String = "SELECT * FROM KHOILOP"
        Dim cmd As New OleDbCommand(strSQL, conn)
        Dim reader As OleDbDataReader = cmd.ExecuteReader()
        While (reader.Read())
            Dim khDTO As New KhoiDTO
            khDTO.MaKhoi = reader("MaKhoi")
            khDTO.TenKhoi = reader("TenKhoi")
            ds.Add(khDTO)
        End While
        conn.Close()
        Return ds
    End Function

End Class
